<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/public/header/permissionCommon.jspf" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>长护险项目管理系统-护工详细信息</title>
</head>
<body >
<div>
    <!-- 主体 -->
    <div style="margin: auto;margin-top: 1%">
            <form id="newcheckForm" class="layui-form" >
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">姓名</label>
                        <div class="layui-input-inline">
                            <input name="hg_name" id="hgName" type="text" autocomplete="off" lay-verify="required"  class="layui-input" disabled>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">身份证号</label>
                        <div class="layui-input-inline">
                            <input name="id_number" id="idNumber" type="text" autocomplete="off" lay-verify="required"  class="layui-input" disabled>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">性别</label>
                        <div class="layui-input-inline">
                            <input name="gender" id="Gender" type="text" autocomplete="off" lay-verify="required"  class="layui-input" disabled>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">所属机构</label>
                        <div class="layui-input-inline">
                            <input name="sbdw" id="SBDW" type="text"  lay-verify="required"  class="layui-input" disabled>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">医保ID</label>
                        <div class="layui-input-inline">
                            <input name="ybid" id="ybID" type="text"  lay-verify="required"  class="layui-input" disabled>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">工种</label>
                        <div class="layui-input-inline">
                            <input name="rylb" id="ryLb" type="text" lay-verify="required"  class="layui-input" disabled>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">职业等级</label>
                        <div class="layui-input-inline">
                            <input name="zylevel" id="zyLevel"  type="text" autocomplete="off" lay-verify="required"  class="layui-input" disabled>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">工作年限</label>
                        <div class="layui-input-inline">
                            <input name="worklength" id="workLength"  type="text" autocomplete="off" lay-verify="required"  class="layui-input" disabled>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">在职情况</label>
                        <div class="layui-input-inline">
                            <input name="status" id="Status"  type="text" autocomplete="off" lay-verify="required"  class="layui-input" disabled>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">电话号码</label>
                    <div class="layui-input-inline">
                        <input name="phonenumber" id="phoneNumber"  type="text" autocomplete="off" lay-verify="required"  class="layui-input" disabled>
                    </div>
                </div>

<%--                <div class="layui-form-item layui-form-text">--%>
<%--                    <label class="layui-form-label">描述</label>--%>
<%--                    <div class="layui-input-block">--%>
<%--                        <textarea type="text" id="checkDescribe" name="checkdescribe" placeholder="请添加描述" class="layui-textarea"></textarea>--%>
<%--                    </div>--%>
<%--                </div>--%>


            </form>

<%--            <div  style="text-align:center">--%>
<%--                <button  type="submit" id="save_btn" class="layui-btn"  >立即提交</button>--%>
<%--            </div>--%>



            <script id="view" type="text/html">
            <table class="layui-table">
                <thead>
                <tr>
                    <th>权限名称</th>
                    <th>权限分类</th>
                    <th>权限路径</th>
                    <th>权限code</th>
                    <th>优先级</th>
                    <th style="width:140px;">操作</th>
                </tr>
                </thead>
                <tbody>
                {{# layui.each(d.rows,function(index,r){ }}
                <tr>
                    <td>{{r.name}}</td>
                    <td>{{r.istype==0?'菜单':(r.istype==1?'功能':'权限')}}</td>
                    <td>{{r.page}}</td>
                    <td>{{r.code}}</td>
                    <td>{{r.zindex}}</td>
                    <td><a class="layui-btn layui-btn-primary layui-btn-xs"
                           onclick="edit('{{r.id}}',0);">编辑</a>
                        <a class="layui-btn layui-btn-xs" onclick="addPerm('{{r.id}}',1)">添加子节点</a>
                        <a class="layui-btn layui-btn-danger layui-btn-xs"
                           onclick="del('{{r.id}}','{{r.name}}')">删除</a>
                    </td>
                </tr>
                {{# }); }}
                </tbody>
            </table>
        </script>
    </div>

    <!--编辑权限 0-->
    <div id="updatePerm" class="layer_self_wrap" style="width:500px;display:none;">
        <form id="permForm" class="layui-form" method="post" action=""
              style="margin-top: 20px;">
            <input id="type" type="hidden" name="type"/>
            <input id="pid" type="hidden" name="pid"/>
            <input id="id" type="hidden" name="id"/>
            <div class="layui-form-item">
                <label class="layui-form-label">权限名称</label>
                <div class="layui-input-inline">
                    <input name="name" lay-verify="required" autocomplete="off" class="layui-input"
                           type="text"/>
                </div>
            </div>
            <div class="layui-form-item" pane="">
                <label class="layui-form-label">权限分类</label>
                <div class="layui-input-block">
                    <%--????--%>
                    <input name="istype" value="0" title="菜单" checked="" type="radio"/>
                    <input name="istype" value="1" title="功能" type="radio"/>
                    <input name="istype" value="2" title="权限" type="radio"/>

                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">权限路径</label>
                <div class="layui-input-inline">
                    <input name="page" lay-verify="required" autocomplete="off" class="layui-input"
                           type="text"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">权限code</label>
                <div class="layui-input-inline">
                    <input name="code" lay-verify="required" autocomplete="off" class="layui-input"
                           type="text"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">权限优先级</label>
                <div class="layui-input-inline">
                    <input name="zindex" autocomplete="off" class="layui-input" type="text"
                           onkeyup="this.value=this.value.replace(/\D/g,'')"
                           onafterpaste="this.value=this.value.replace(/\D/g,'')"/>
                </div>
                <div class="layui-form-mid layui-word-aux">请填写大于0的整数数字</div>
            </div>

            <div class="layui-form-item layui-form-text" style="margin-right: 5%;">
                <label class="layui-form-label">文本域</label>
                <div class="layui-input-block">
                    <textarea name="descpt" placeholder="请输入内容" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button id="commitbtn" class="layui-btn" lay-submit="" lay-filter="permSubmit">提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>

    <!--添加子节点 1-->
    <div id="updatePerm1" class="layer_self_wrap" style="width:500px;display:none;">
        <form id="permForm1" class="layui-form" method="post" action=""
              style="margin-top: 20px;">
            <input type="hidden" name="type"/>
            <input type="hidden" name="pid"/>
            <input type="hidden" name="id"/>
            <div class="layui-form-item">
                <label class="layui-form-label">权限名称</label>
                <div class="layui-input-inline">
                    <input name="name" lay-verify="required" autocomplete="off" class="layui-input"
                           type="text"/>
                </div>
            </div>
            <div class="layui-form-item" pane="">
                <label class="layui-form-label">权限分类</label>
                <div class="layui-input-block" id="inputRadio">
                    <%--????--%>
                    <input name="istype" value="0" title="菜单" type="radio"/>
                    <input name="istype" value="1" title="功能"  checked="" type="radio"/>
                    <input name="istype" value="2" title="权限" type="radio"/>

                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">权限路径</label>
                <div class="layui-input-inline">
                    <input name="page" lay-verify="required" autocomplete="off" class="layui-input"
                           type="text"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">权限code</label>
                <div class="layui-input-inline">
                    <input name="code" lay-verify="required" autocomplete="off" class="layui-input"
                           type="text"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">权限优先级</label>
                <div class="layui-input-inline">
                    <input name="zindex" autocomplete="off" class="layui-input" type="text"
                           onkeyup="this.value=this.value.replace(/\D/g,'')"
                           onafterpaste="this.value=this.value.replace(/\D/g,'')"/>
                </div>
                <div class="layui-form-mid layui-word-aux">请填写大于0的整数数字</div>
            </div>

            <div class="layui-form-item layui-form-text"  style="margin-right: 5%;">
                <label class="layui-form-label">文本域</label>
                <div class="layui-input-block">
                    <textarea name="descpt" placeholder="请输入内容" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="permSubmit">提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>


<%--    <!--底部-->--%>
<%--    <div id="footer"></div>--%>


    <%--<script src="${webPath}/js/permission/auth/permList.js"></script>--%>
    <script>
        $("#header").load("${webPath}/publicPages/permission/fragments/header.jsp");
        $("#footer").load("${webPath}/publicPages/permission/fragments/footer.jsp");
    </script>
    <script>
        var perm = '${permList}';
        var permList = eval('(' + perm + ')');
        console.log(permList);
        console.log("permIdList:" + typeof(permList));
        console.log(Object.prototype.toString.call(permList));
        //初始化treegrid 页面表格
        var basepath = "/js/treegrid/";
        layui.config({
            base: basepath
        }).use(['laytpl', 'treegrid'], function () {
            var laytpl = layui.laytpl,
                treegrid = layui.treegrid;
            treegrid.config.render = function (viewid, data) {
                var view = document.getElementById(viewid).innerHTML;
                return laytpl(view).render(data) || '';
            };

            var treeForm = treegrid.createNew({
                elem: 'permTable',
                view: 'view',
                data: {rows: permList},
                parentid: 'pid',
                singleSelect: false
            });
            treeForm.build();

        });
    </script>


    <%--  下方js代码可统一归入js文件中  --%>
    <%--  checkresult命名的input单选框，点击事件--%>
    <script>
        $("input[name=checkresult]").click(function(){
            var result = $(this).val();
            alert(result);
        });
    </script>
    <%--输入检查日期组件    --%>
    <script>
        layui.use('laydate', function(){
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#checkdate' //指定元素
            });
        });
    </script>





</div>
</body>
</html>